



alter  trigger [tb_commissionraw_bd] on dbo.tb_commissionraw instead of delete
as
  declare @obid integer,          @obno integer, @obdtlno integer    
    
begin
  set nocount on
  declare tb_commissionraw_cur cursor forward_only static optimistic for
  select o.bid,o.bno, o.bdtlno
  from deleted o
  open tb_commissionraw_cur
  fetch next from tb_commissionraw_cur into
  @obid,@obno, @obdtlno
  while ( @@fetch_status = 0 )
  begin
    delete from tb_commissionrawsub where bid = @obid and bno=@obno and bdtlno=@obdtlno
    delete from tb_commissionraw where bid = @obid and bno=@obno and bdtlno=@obdtlno
    fetch next from tb_commissionraw_cur into
    @obid,@obno, @obdtlno
  end
  close tb_commissionraw_cur
  deallocate tb_commissionraw_cur  

end





